﻿
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ListCustomers.ascx.cs"
    Inherits="Admin_UserControl_ucListEmail" %>

<script type="text/javascript">
    function s() {
        var t = document.getElementById("<%=grdListEmail.ClientID%>");
        var t2 = t.cloneNode(true)
        for (i = t2.rows.length - 1; i > 0; i--)
            t2.deleteRow(i)
        t.deleteRow(0)
        a.appendChild(t2)
    }
    window.onload = s
</script>



<asp:DataList ID="DataList1" runat="server" OnItemCommand="DataList1_ItemCommand"
    OnItemDataBound="DataList1_ItemDataBound" RepeatDirection="Horizontal">
    <SeparatorTemplate>
        | &nbsp;
    </SeparatorTemplate>
    <ItemTemplate>
        <asp:LinkButton ID="lnkbtnPaging" runat="server" CommandArgument='<%# Bind("PageIndex") %>'
            Text='<%# Bind("PageText") %>'></asp:LinkButton>
    </ItemTemplate>
</asp:DataList>
<br />
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <div id="a">
            </div>
            <div style="overflow-y: scroll; height: 360px">
                <asp:GridView ID="grdListEmail" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                    EmptyDataText="Not Found Customer" AllowSorting="True" CssClass="yui" Width="100%"
                    OnPageIndexChanging="grdListEmail_PageIndexChanging" OnSorting="grdListEmail_Sorting"
                    OnRowDataBound="grdListEmail_RowDataBound">
                    <Columns>
                        <asp:BoundField DataField="IDEmail" HeaderText="E-ID" SortExpression="IDEmail">
                            <HeaderStyle Width="4%" ForeColor="White" />
                            <ItemStyle Width="4%" />
                        </asp:BoundField>
                        <asp:HyperLinkField DataTextField="FName" HeaderText="First Name" SortExpression="FName"
                            DataNavigateUrlFields="CusID" 
                            DataNavigateUrlFormatString="~/Admin/CustomerDetails.aspx?idCus={0}" >
                            <HeaderStyle Width="9%" ForeColor="White" />
                            <ItemStyle Width="9%" HorizontalAlign="Center" />
                        </asp:HyperLinkField>
                        <asp:BoundField DataField="LName" HeaderText="Last Name" 
                            SortExpression="LName" >
                            <HeaderStyle Width="6%" ForeColor="White" />
                            <ItemStyle Width="13%" HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField DataField="EmailAddress" HeaderText="Email Address" SortExpression="EmailAddress">
                            <HeaderStyle Width="20%" ForeColor="White" />
                            <ItemStyle Width="20%" HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DateActive" HeaderText="Date Active" SortExpression="DateActive"
                            DataFormatString="{0:dd/MM/yyyy}" >
                           <HeaderStyle Width="13%" HorizontalAlign="Center" ForeColor="White" />
                            <ItemStyle HorizontalAlign="Center" Width="13%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="DateExpiry" HeaderText="Date Expiry" 
                            SortExpression="DateExpiry" >
                            <HeaderStyle HorizontalAlign="Center" Width="10%" ForeColor="White" />
                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Notes">
                            <ItemTemplate>
                                <asp:TextBox ID="txtNotes" Text="notes" TextMode="MultiLine" Width="77%" Height="20px"
                                    runat="server"></asp:TextBox>
                                <asp:CheckBox ID="ckEnable" runat="server" OnCheckedChanged="ckEnable_CheckedChanged"
                                    AutoPostBack="true" />
                                <asp:ImageButton ID="btnSave" runat="server" ToolTip="Save" CommandName="Save" CommandArgument='<%# Eval("IDEmail") %>'
                                    OnClick="btnSave_Click" ImageUrl="~/Admin/img/ic-save.png" />
                            </ItemTemplate>
                            <HeaderStyle Width="60%" ForeColor="White" />
                            <ItemStyle HorizontalAlign="Center" Width="60%" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Options">
                            <ItemTemplate>
                                <asp:HyperLink ID="hypDetails" runat="server" ToolTip="Details">
                                    <asp:Image ID="imgDetails" runat="server" ImageUrl="~/Admin/img/view-details.png" />
                                </asp:HyperLink>
                                <%--<asp:ImageButton ID="btnDetails" runat="server" ToolTip="Details" CausesValidation="false"
                    CommandName="delete" CommandArgument='<%# Eval("CusID") %>' ImageUrl="~/Admin/img/view-details.png" />--%>
                            </ItemTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="">
                            <ItemTemplate>
                                <asp:ImageButton ID="btnDelImg" runat="server" ToolTip="Delete" CausesValidation="false"
                                    CommandName="delete" CommandArgument='<%# Eval("IDEmail") %>' ImageUrl="~/Admin/img/close.png"
                                    OnClick="btnDelImg_Click" />
                            </ItemTemplate>
                            <HeaderStyle Width="90px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle CssClass="clsGrdHeader" />
                    <RowStyle CssClass="clsGrdRow" />
                    <AlternatingRowStyle CssClass="clsGrdAlternateRow" />
                    <PagerStyle CssClass="clsPage" />
                </asp:GridView>
            </div>
        </td>
    </tr>
</table>
